package jmine.tec.di.wrapper;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

import jmine.tec.annotations.Unmodifiable;
import jmine.tec.utils.Tuple;
import jmine.tec.utils.UnmodifiableTuple;

/**
 * Nao faz wrapping nenhum
 * 
 * @author MarceloT
 */
@Unmodifiable
public final class NoWrapper implements Wrapper, Serializable {
    private static final long serialVersionUID = 2526213696561330849L;

    /**
     * Wrapp varios valores
     * 
     * @param propertyKeys os nomes das propriedades
     * @param propertyValues os valores das propriedades
     * @param valueType o tipo de valor
     * @return Object
     */
    public Object wrap(Object[] propertyKeys, Object[] propertyValues, Class<?> valueType) {
        return propertyValues[0];
    }

    /**
     * Verifica se o tipo deste wrapper é compativel com o tipo de container passado
     * 
     * @param containerType Class
     * @return boolean
     */
    public boolean isTypeCompatible(Class<?> containerType) {
        return true;
    }

    /**
     * @param propertyKey name
     * @param propertyValue value
     * @param valueType type
     * @return propertyValue
     */
    public Object wrap(Object propertyKey, Object propertyValue, Class<?> valueType) {
        return propertyValue;
    }

    /**
     * @return <code>false</code>
     */
    public boolean isManyWrapper() {
        return false;
    }

    /**
     * {@inheritDoc}
     */
    public boolean checkContainedType(Object resolved, Class<?> requiredComponentClass) {
        return false;
    }

    /**
     * {@inheritDoc}
     */
    public List<Tuple<?, ?>> collect(Object resolved, String name) {
        return Collections.<Tuple<?, ?>> singletonList(UnmodifiableTuple.newTuple(name, resolved));
    }

}
